lib/repo-pull: Disable LAN updates by default
authorMatthew Leeds <matthew.leeds@endlessm.com>
Thu, 18 Oct 2018 00:02:27 +0000 (17:02 -0700)
committerAtomic Bot <atomic-devel@projectatomic.io>
Sun, 21 Oct 2018 19:11:43 +0000 (19:11 +0000)
This commit disables searching on the local network for refs, unless
explicitly requested by the user either by changing the value of the
"core.repo-finders" config option, or by passing an OstreeRepoFinderAvahi to
ostree_repo_find_remotes_async() / ostree_repo_finder_resolve_async(),
or by specifying "lan" in the --finders option of the find-remotes
command.

The primary reason for this is that ostree_repo_find_remotes_async()
takes about 40% longer to complete with the LAN finder enabled, and that
API is used widely (e.g. in every flatpak operation). It's also probable
that some users don't want ostree doing potentially unexpected traffic
on the local network, even though everything pulled from a peer is GPG
verified.

Flathub will soon deploy collection IDs to everyone[1] so these code
paths will soon see a lot more use and that's why this change is being
made now.

Endless is the only potential user of the LAN updates feature, and we
can revert this patch on our fork of ostree. For it to be used outside
Endless OS we will need to upstream eos-updater-avahi and
eos-update-server into ostree.

[1] https://github.com/flathub/flathub/issues/676

Closes: #1758
Approved by: cgwalters

man/ostree.repo-config.xml
src/libostree/ostree-repo.c

index 49044b460696353fd75167a768e6239e263d45f1..3ea2448615fe2f123779b78b4a3822162f0299ea 100644 (file)
@@ -225,8 +225,9 @@ Boston, MA 02111-1307, USA.
         of finders isn't explicitly specified, either by a consumer of
         libostree API or on the command line. Possible values:
         <literal>config</literal>, <literal>lan</literal>, and
-        <literal>mount</literal> (or any combination thereof). If
-        unset, this defaults to <literal>config;lan;mount;</literal>.
+        <literal>mount</literal> (or any combination thereof). If unset, this
+        defaults to <literal>config;mount;</literal> (since the LAN finder is
+        costly).
         </para></listitem>
       </varlistentry>
     </variablelist>
index 18fb7733d5ede6ca36c97ce38bd7c090aa9da8cb..fe095057f991ba10f347e5057bfef7985c20853d 100644 (file)
@@ -2967,7 +2967,7 @@ reload_core_config (OstreeRepo          *self,
 
     /* Fall back to a default set of finders */
     if (configured_finders == NULL)
-      configured_finders = g_strsplit ("config;lan;mount", ";", -1);
+      configured_finders = g_strsplit ("config;mount", ";", -1);
 
     g_clear_pointer (&self->repo_finders, g_strfreev);
     self->repo_finders = g_steal_pointer (&configured_finders);